package com.seanliao.nav.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.convert.DurationUnit;
import org.springframework.stereotype.Component;

import java.time.Duration;
import java.time.temporal.ChronoUnit;

@Data
@Component
@ConfigurationProperties("my.login")
public class LoginProperties {

    /**
     * jwt密钥
     */
    private String jwtKey;

    /**
     * 令牌有效时长，默认7天
     * 有效单位：ns(毫秒) ms(微秒) s(秒) m(分) h(时) d(天)
     */
    @DurationUnit(ChronoUnit.DAYS)
    private Duration effectiveTime = Duration.ofDays(7);

    /**
     * 临时令牌有效时长，默认1天
     * 有效单位：ns(毫秒) ms(微秒) s(秒) m(分) h(时) d(天)
     */
    @DurationUnit(ChronoUnit.DAYS)
    private Duration tempTime = Duration.ofDays(1);

}
